package edu.gatech.cs2340.mule.tests;

//import static org.junit.Assert.*;



import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;



import edu.gatech.cs2340.mule.model.Mule;
import edu.gatech.cs2340.mule.model.Store;

/**
 * This JUnit file tests the Store class.
 * 
 * @author Tyler Litrel
 *
 */
public class StoreTest {
	Store store;
	
	@Before
	public void setUp() throws Exception {
		this.store = new Store();
	}
	
	@Test
	public void initialAmountTest() {
		Assert.assertEquals(store.getEnergyStock(),16);
		Assert.assertEquals(store.getSmithoreStock(),0);
		Assert.assertEquals(store.getFoodStock(),16);
		//Assert.assertEquals(store.getEnergyAmount(),16);
		
	}
	
	@Test
	public void costTest() {
		Assert.assertEquals(store.calculateEnergyPurchasePrice(0),0);
		Assert.assertEquals(store.calculateEnergyPurchasePrice(1), 25);
		Assert.assertEquals(store.calculateEnergyPurchasePrice(3),75);
		//Assert.assertEquals(store.getEnergyAmount(),16);
		Assert.assertEquals(store.calculateFoodPurchasePrice(0),0);
		Assert.assertEquals(store.calculateFoodPurchasePrice(1), 30);
		Assert.assertEquals(store.calculateFoodPurchasePrice(3),90);
		
		Assert.assertEquals(store.calculateSmithorePurchasePrice(0),0);
		Assert.assertEquals(store.calculateSmithorePurchasePrice(1), 50);
		Assert.assertEquals(store.calculateSmithorePurchasePrice(3),150);
		
	}
	@Test
	public void muleCostTest() {
		Assert.assertEquals(store.calculateMulePurchasePrice(Mule.FOOD_TYPE),130);
		Assert.assertEquals(store.calculateMulePurchasePrice(Mule.SMITHORE_TYPE),175);
		Assert.assertEquals(store.calculateMulePurchasePrice(Mule.ENERGY_TYPE),150);
	
	}
	
	@Test
	public void mulePurchaseTest() {
		
		Assert.assertEquals(store.purchaseMule(Mule.FOOD_TYPE).getType(),Mule.FOOD_TYPE);
		Assert.assertEquals(store.purchaseMule(Mule.ENERGY_TYPE).getType(),Mule.ENERGY_TYPE);
		Assert.assertEquals(store.purchaseMule(Mule.SMITHORE_TYPE).getType(),Mule.SMITHORE_TYPE);
	}
	@Test
	public void resourcePurchaseTest() {
		Assert.assertFalse(store.purchaseEnergy(10000));
		Assert.assertFalse(store.purchaseFood(10000));
		Assert.assertFalse(store.purchaseSmithore(10000));
		
		Assert.assertTrue(store.purchaseEnergy(1));
		Assert.assertTrue(store.purchaseEnergy(1));
		Assert.assertTrue(store.purchaseEnergy(1));
		
	}
	@Test
	public void resourceTradeInTest() {
		this.store = new Store();
		Assert.assertEquals(store.getEnergyStock(),16);
		Assert.assertEquals(store.getSmithoreStock(),0);
		Assert.assertEquals(store.getFoodStock(),16);
		
		store.tradeInEnergy(10);
		store.tradeInSmithore(10);
		store.tradeInFood(10);
		
		Assert.assertEquals(store.getEnergyStock(),26);
		Assert.assertEquals(store.getSmithoreStock(),10);
		Assert.assertEquals(store.getFoodStock(),26);
		
	}
	
}	
